' are defined in Manufacturer and Product Identifiers in
' the Platform SDK product documentation.
wPid As Integer ' Product identifier for the waveform-audio input device.
' Product identifiers are defined in Manufacturer and Product
' Identifiers in the Platform SDK product documentation.
vDriverVersion As Long ' Version number of the device driver for the
' waveform-audio input device. The high-order byte
' is the major version number, and the low-order byte
' is the minor version number.
szPname As String * 32 ' Product name in a null-terminated string.
dwFormats As Long ' Standard formats that are supported. See the Platform
' SDK product documentation for more information.
wChannels As Integer ' Number specifying whether the device supports
' mono (1) or stereo (2) input.
End Type
Type WAVEFORMAT
' The WAVEFORMAT user-defined type describes the format of waveform-audio data. Only
' format information common to all waveform-audio data formats is included in this
' user-defined type.
wFormatTag As Integer ' Format type. Use the constant WAVE_FORMAT_PCM Waveform-audio data
' to define the data as PCM.
nChannels As Integer ' Number of channels in the waveform-audio data. Mono data uses one
' channel and stereo data uses two channels.
nSamplesPerSec As Long ' Sample rate, in samples per second.
nAvgBytesPerSec As Long ' Required average data transfer rate, in bytes per second. For
' example, 16-bit stereo at 44.1 kHz has an average data rate of
' 176,400 bytes per second (2 channels ù 2 bytes per sample per
' channel ù 44,100 samples per second).
nBlockAlign As Integer ' Block alignment, in bytes. The block alignment is the minimum atomic unit of data. For PCM data, the block alignment is the number of bytes used by a single sample, including data for both channels if the data is stereo. For example, the block alignment for 16-bit stereo PCM is 4 bytes (2 channels ù 2 bytes per sample).
wBitsPerSample As Integer ' For buffer estimation
cbSize As Integer ' Block size of the data.
End Type
Declare Function waveInOpen Lib "winmm.dll" (lphWaveIn As Long, _
ByVal uDeviceID As Long, _
lpFormat As WAVEFORMAT, _
ByVal dwCallback As Long, _
ByVal dwInstance As Long, _
ByVal dwFlags As Long) As Long
' The waveInOpen function opens the given waveform-audio input device for recording. The function
' uses the following parameters
' lphWaveIn- a long value that is the handle identifying the open waveform-audio input
' device. Use this handle to identify the device when calling other
' waveform-audio input functions. This parameter can be NULL if WAVE_FORMAT_QUERY
' is specified for fdwOpen.
' uDeviceID- a long value that identifies the waveform-audio input device to open.
' This parameter can be either a device identifier or a handle of an open
' waveform-audio input device.
' lpFormat- the WAVEFORMAT user-defined typed that identifies the desired format for
' recording waveform-audio data.
' dwCallback- a long value that is an event handle, a handle to a window, or the identifier
' of a thread to be called during waveform-audio recording to process messages
' related to the progress of recording. If no callback function is required,
' this value can be zero. For more information on the callback function,
' see waveInProc.
' dwCallback- a long value that is the user-instance data passed to the callback mechanism.
' This parameter is not used with the window callback mechanism.
' dwFlags- Flags for opening the device. The following values are defined: